﻿// Decompiled with JetBrains decompiler
// Type: Microsoft.Internal.Web.Utils.HashCodeCombiner
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Collections;

namespace Microsoft.Internal.Web.Utils
{
  internal class HashCodeCombiner
  {
    private long _combinedHash64 = 5381;

    public int CombinedHash => this._combinedHash64.GetHashCode();

    public HashCodeCombiner Add(IEnumerable e)
    {
      if (e == null)
      {
        this.Add(0);
      }
      else
      {
        int i = 0;
        foreach (object o in e)
        {
          this.Add(o);
          ++i;
        }
        this.Add(i);
      }
      return this;
    }

    public HashCodeCombiner Add(int i)
    {
      this._combinedHash64 = (this._combinedHash64 << 5) + this._combinedHash64 ^ (long) i;
      return this;
    }

    public HashCodeCombiner Add(object o)
    {
      this.Add(o != null ? o.GetHashCode() : 0);
      return this;
    }

    public static HashCodeCombiner Start() => new HashCodeCombiner();
  }
}
